<!DOCTYPE html>
<html class=" js csstransforms3d" lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>系统管理员信息修改</title>
    <link rel="stylesheet" th:href="@{~/static/css/base.css}" href="../static/css/base.css">
    <link rel="stylesheet" th:href="@{~/static/css/page.css}" href="../static/css/page.css">
    <script type="text/javascript" th:src="@{~/static/js/modernizr.js}" src="../static/js/modernizr.js"></script>
    <script type="text/javascript" th:src="@{~/static/js/min.js}" src="../static/js/min.js"></script>
    <script type="text/javascript" th:href="@{~/static/js/jquery-3.3.1.min.js}"
            src="../static/js/jquery-3.3.1.min.js"></script>
    <script>
        UrlParm = function() { // url参数
            var data, index;
            (function init() {
                data = [];
                index = {};
                var u = window.location.search.substr(1);
                if (u != '') {
                    var parms = decodeURIComponent(u).split('&');
                    for (var i = 0, len = parms.length; i < len; i++) {
                        if (parms[i] != '') {
                            var p = parms[i].split("=");
                            if (p.length == 1 || (p.length == 2 && p[1] == '')) { // p | p=
                                data.push(['']);
                                index[p[0]] = data.length - 1;
                            } else if (typeof(p[0]) == 'undefined' || p[0] == '') { // =c | =
                                data[0] = [p[1]];
                            } else if (typeof(index[p[0]]) == 'undefined') { // c=aaa
                                data.push([p[1]]);
                                index[p[0]] = data.length - 1;
                            } else { // c=aaa
                                data[index[p[0]]].push(p[1]);
                            }
                        }
                    }
                }
            })();
            return {
                parm: function(o) { // o: 参数名或者参数次序
                    try {
                        return (typeof(o) == 'number' ? data[o][0] : data[index[o]][0]);
                    } catch (e) {}
                },
                parmValues: function(o) { //  o: 参数名或者参数次序
                    try {
                        return (typeof(o) == 'number' ? data[o] : data[index[o]]);
                    } catch (e) {}
                },
                hasParm: function(parmName) {
                    return typeof(parmName) == 'string' ? typeof(index[parmName]) != 'undefined' : false;
                },
                parmMap: function() {
                    var map = {};
                    try {
                        for (var p in index) {
                            map[p] = data[index[p]];
                        }
                    } catch (e) {}
                    return map;
                }
            }
        }();
    </script>
    <script>
        $(function () {
            var id = UrlParm.parm("id");
            $.ajax({
                url: "http://localhost/admin/id="+id,
                type: "GET",
                datatype: "jsonp",
                header: {
                    'Content-Type': 'application/json'
                },
                async: false,
                success: function (res) {
                    res = JSON.parse(res)
                    if (res.length > 0) {
                        var    result = ` <h5 class="pubtitle">管理员id(不可修改)</h5>
                        <div class="pub-txt-bar">
                            <input type="text" class="shuruTxt" readonly="readonly" id="adminId" name="admin_id" value="${res[0].admin_id}" ></input>
                        </div>
                        <h5 class="pubtitle">管理员名称</h5>
                        <div class="pub-txt-bar">
                            <input type="text" class="shuruTxt" name="admin_name"  value="${res[0].admin_name}">
                        </div>
                        <h5 class="pubtitle">管理员账号</h5>
                        <div class="pub-txt-bar">
                            <input type="text" class="shuruTxt" name="admin_login"  value="${res[0].admin_acc}">
                        </div>
                        <h5 class="pubtitle">管理员密码</h5>

                         <div class="pub-txt-bar">
                            <input type="password" class="shuruTxt" name="admin_pass_new"  value="" placeholder= "请输入新密码">
                        </div>


`
                        $("#updateData").empty().append(result)
                    }
                }
            })
        })
    </script>
</head>
<body style="background: rgb(246, 245, 250);">
<!--content S-->
<div class="super-content">

    <div class="superCtab">
        <div class="publishArt">
            <h4>系统管理员信息修改</h4>
            <div class="pubMain">
                <form action="http://localhost/update" method="post">
                    <div id="updateData">
                    </div>

                    <div class="pub-btn">
                        <button type="submit" class="saveBtn">修改</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

</div>
</body>
</html>